Learn R Programming

Rfast (version 1.2)

Row-wise minimum and maximum: Row-wise minimum and maximum of a matrix.

Description

Row-wise minimum and maximum of a matrix.

Usage

rowMins(x)
rowMaxs(x)

Arguments

x
A numerical matrix with data.

Value

A vector with the relevant values.

See Also

colMins, colMaxs, nth, colMedians, colVars, sort_mat

Examples

Run this code
x <- matrix( rnorm(1000 * 2000), ncol = 2000 )

system.time( rowMins(x) )
system.time( apply(x, 1, min) )
s1 = rowMins(x)
s2 = apply(x, 1, min)

system.time( rowMaxs(x) )
system.time( apply(x, 1, max) )
s1 = rowMaxs(x)
s2 = apply(x, 1, max)

Run the code above in your browser using DataLab